package main

import (
	"fmt"
	"log"
	"net/http"
	"os"
	"strings"
)

func arrayToString(arr []string) string {
	var result string
	result= strings.Join(arr,",")
	return result
}


func main() {
	http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
		qh:= r.Header
		for key,value := range qh{
			//fmt.Println("--------------------------------")
			//fmt.Println(key)
			//fmt.Println(value)
			//fmt.Printf("value===========%T\n",value)
			//
			//fmt.Println("--------------------------------")
			w.Header().Set(key,arrayToString(value))

		}
		w.Header().Set("VERSION",os.Getenv("VERSION"))
		w.Header().Set("RemoteAddr",r.RemoteAddr)
		w.WriteHeader(http.StatusOK)
		fmt.Println("requestIP===========",r.RemoteAddr)

	})
	log.Println(http.ListenAndServe(":3000", nil))
}
